package com.cv.platform.controller.platform.comment;

import com.cv.framework.common.pojo.PageResult;
import com.cv.framework.common.pojo.Result;
import com.cv.platform.controller.platform.comment.vo.record.CvCommentCreateReqVO;
import com.cv.platform.controller.platform.comment.vo.record.CvCommentReqVO;
import com.cv.platform.controller.platform.comment.vo.record.CvCommentRespVO;
import com.cv.platform.service.comment.CvCommentService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.annotation.security.PermitAll;

/**
 * 视频平台 - 视频评论控制层
 *
 * @author Charles_XDXD
 */
@Tag(name = "视频平台 - 视频评论控制层")
@RestController
@RequestMapping("/platform/video/comment")
public class CvCommentController {

    @Resource
    private CvCommentService cvCommentService;

    @PostMapping("create")
    @Operation(summary = "创建视频评论")
    public Result<Void> createComment(@RequestBody CvCommentCreateReqVO reqVO) {
        cvCommentService.createComment(reqVO);
        return Result.success();
    }

    @GetMapping("page")
    @Operation(summary = "视频评论分页数据")
    @PermitAll
    public Result<PageResult<CvCommentRespVO>> getCommentPage(CvCommentReqVO reqVO) {
        return Result.success(cvCommentService.getCommentPage(reqVO));
    }

}
